function PHatCalc= calculatePHat_fixedW(w,t,X,wantedZ,R,C)
    PHatCalc=zeros(t,R,C);
    for i = 1: t
        wantedZZ = wantedZ(i);
    for ii=1:R % 9rows
        for jj=1:C
            if jj==1
                down=normcdf((X(ii,jj+1)-w.*wantedZZ)./sqrt(1-w.^2),0,1);
                PHatCalc(i,ii,jj)=1-down;
            elseif jj==C
                up=normcdf((X(ii,jj)-w.*wantedZZ)./sqrt(1-w.^2),0,1);
                PHatCalc(i,ii,jj)=up;
            else
                up=normcdf((X(ii,jj)-w.*wantedZZ)./sqrt(1-w.^2),0,1);
                down=normcdf((X(ii,jj+1)-w.*wantedZZ)./sqrt(1-w.^2),0,1);
                PHatCalc(i,ii,jj)=up-down;
            end
        end
    end
    end
end

